import numpy as np
import pandas as pd
from pandas import Series,DataFrame

data = DataFrame(np.arange(6).reshape((2,3)),
                 index=pd.Index(['Ohio', 'Colorado'], name='state'),
                 columns=pd.Index(['one', 'two', 'three'], name='number'))
result = data.stack()

print data
print result
print result.unstack()
